{extend name="panel/layout" /}
{block name="main"}
<div class="row">
    <div class="col-md-12">
        <div class="panel">
            <div class="panel-heading">邀请好友</div>
            <div class="panel-body">
                {if condition="!$userInfo['upid']"}
                <div class="alert alert-warning" role="alert"><i class="fa fa-exclamation"></i>&nbsp;你还没填写邀请码，现在填写就能获取{:config('zz_point_invite1')}元奖励
                </div>
                <form role="form" class="form-horizontal" method="post" style="margin: 15px;">
                    <input type="hidden" name="action" value="invite">
                    <div class="form-group">
                        <div class="input-group">
                            <div class="input-group-addon">邀请码</div>
                            <input type="text" name="invite" class="form-control" placeholder="输入邀请码">
                            <div class="input-group-addon"><input type="submit" value="提交" class="btn-primary">
                            </div>
                        </div>
                    </div>
                </form>
                <hr>
                {else}
                <div class="alert alert-info" role="alert"><i class="fa fa-exclamation"></i>&nbsp;你已经填写邀请码，你的上级用户UID:{$userInfo.upid}
                </div>
                {/if}
                <div class="alert alert-success" role="alert">
                    我的推广邀请码：{if condition="$userInfo['invite']"}
                    <span class="text-warning" style="font-size: 20px;">{$userInfo.invite}</span>{else}<a
                        href="?action=getInvite" class="btn btn-info">点击获取</a>{/if}
                    <br>邀请用户之后，下级用户消费你将永久获得{:config('zz_invite_rate')}%的提成！
                </div>

            </div>
        </div>
    </div>
</div>
<div class="row">
    <div class="col-md-12">
        <div class="panel">
            <div class="panel-heading">我的邀请记录
            <span class="label label-danger pull-right"><a href="{:url('rank',['kind'=>'invite'])}"
                                                           class="btn-xs">查看排行榜</a></span></div>
            <div class="panel-body table-responsive text-center">
                <table class="table table-hover table-striped">
                    <thead>
                    <tr>
                        <th class="text-center">UID</th>
                        <th class="text-center">用户名</th>
                        <th class="text-center">完成邀请时间</th>
                    </tr>
                    </thead>
                    <tbody>
                    {volist name="$invites" id="invite"}
                    <tr>
                        <td class="text-center">{$invite.uid}</td>
                        <td class="text-center">{$invite.user}</td>
                        <td class="text-center">{$invite.invitetime}</td>
                    </tr>
                    {/volist}
                    </tbody>
                </table>
                {$pageList->showPage()}
            </div>
        </div>
    </div>
</div>
{/block}